3.150 \(\int \sin ^2(e+f x) (a+b \sin (e+f x)) \, dx\)

Optimal. Leaf size=55 \[ -\frac{a \sin (e+f x) \cos (e+f x)}{2 f}+\frac{a x}{2}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{b \cos (e+f x)}{f} \]

[Out]

(a*x)/2 - (b*Cos[e + f*x])/f + (b*Cos[e + f*x]^3)/(3*f) - (a*Cos[e + f*x]*Sin[e + f*x])/(2*f)

________________________________________________________________________________________

Rubi [A]  time = 0.044637, antiderivative size = 55, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 19, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.21, Rules used = {2748, 2635, 8, 2633} \[ -\frac{a \sin (e+f x) \cos (e+f x)}{2 f}+\frac{a x}{2}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{b \cos (e+f x)}{f} \]

Antiderivative was successfully verified.

[In]

Int[Sin[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

(a*x)/2 - (b*Cos[e + f*x])/f + (b*Cos[e + f*x]^3)/(3*f) - (a*Cos[e + f*x]*Sin[e + f*x])/(2*f)

Rule 2748

Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)]), x_Symbol] :> Dist[c, Int[(b*S
in[e + f*x])^m, x], x] + Dist[d/b, Int[(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]

Rule 2635

Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> -Simp[(b*Cos[c + d*x]*(b*Sin[c + d*x])^(n - 1))/(d*n),
x] + Dist[(b^2*(n - 1))/n, Int[(b*Sin[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && Integer
Q[2*n]

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 2633

Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> -Dist[d^(-1), Subst[Int[Expand[(1 - x^2)^((n - 1)/2), x], x], x
, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]

Rubi steps

\begin{align*} \int \sin ^2(e+f x) (a+b \sin (e+f x)) \, dx &=a \int \sin ^2(e+f x) \, dx+b \int \sin ^3(e+f x) \, dx\\ &=-\frac{a \cos (e+f x) \sin (e+f x)}{2 f}+\frac{1}{2} a \int 1 \, dx-\frac{b \operatorname{Subst}\left (\int \left (1-x^2\right ) \, dx,x,\cos (e+f x)\right )}{f}\\ &=\frac{a x}{2}-\frac{b \cos (e+f x)}{f}+\frac{b \cos ^3(e+f x)}{3 f}-\frac{a \cos (e+f x) \sin (e+f x)}{2 f}\\ \end{align*}

Mathematica [A]  time = 0.0578861, size = 60, normalized size = 1.09 \[ \frac{a (e+f x)}{2 f}-\frac{a \sin (2 (e+f x))}{4 f}-\frac{3 b \cos (e+f x)}{4 f}+\frac{b \cos (3 (e+f x))}{12 f} \]

Antiderivative was successfully verified.

[In]

Integrate[Sin[e + f*x]^2*(a + b*Sin[e + f*x]),x]

[Out]

(a*(e + f*x))/(2*f) - (3*b*Cos[e + f*x])/(4*f) + (b*Cos[3*(e + f*x)])/(12*f) - (a*Sin[2*(e + f*x)])/(4*f)

________________________________________________________________________________________

Maple [A]  time = 0.014, size = 49, normalized size = 0.9 \begin{align*}{\frac{1}{f} \left ( -{\frac{b \left ( 2+ \left ( \sin \left ( fx+e \right ) \right ) ^{2} \right ) \cos \left ( fx+e \right ) }{3}}+a \left ( -{\frac{\sin \left ( fx+e \right ) \cos \left ( fx+e \right ) }{2}}+{\frac{fx}{2}}+{\frac{e}{2}} \right ) \right ) } \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(sin(f*x+e)^2*(a+b*sin(f*x+e)),x)

[Out]

1/f*(-1/3*b*(2+sin(f*x+e)^2)*cos(f*x+e)+a*(-1/2*sin(f*x+e)*cos(f*x+e)+1/2*f*x+1/2*e))

________________________________________________________________________________________

Maxima [A]  time = 1.62178, size = 65, normalized size = 1.18 \begin{align*} \frac{3 \,{\left (2 \, f x + 2 \, e - \sin \left (2 \, f x + 2 \, e\right )\right )} a + 4 \,{\left (\cos \left (f x + e\right )^{3} - 3 \, \cos \left (f x + e\right )\right )} b}{12 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="maxima")

[Out]

1/12*(3*(2*f*x + 2*e - sin(2*f*x + 2*e))*a + 4*(cos(f*x + e)^3 - 3*cos(f*x + e))*b)/f

________________________________________________________________________________________

Fricas [A]  time = 1.59012, size = 120, normalized size = 2.18 \begin{align*} \frac{2 \, b \cos \left (f x + e\right )^{3} + 3 \, a f x - 3 \, a \cos \left (f x + e\right ) \sin \left (f x + e\right ) - 6 \, b \cos \left (f x + e\right )}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="fricas")

[Out]

1/6*(2*b*cos(f*x + e)^3 + 3*a*f*x - 3*a*cos(f*x + e)*sin(f*x + e) - 6*b*cos(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 0.918767, size = 92, normalized size = 1.67 \begin{align*} \begin{cases} \frac{a x \sin ^{2}{\left (e + f x \right )}}{2} + \frac{a x \cos ^{2}{\left (e + f x \right )}}{2} - \frac{a \sin{\left (e + f x \right )} \cos{\left (e + f x \right )}}{2 f} - \frac{b \sin ^{2}{\left (e + f x \right )} \cos{\left (e + f x \right )}}{f} - \frac{2 b \cos ^{3}{\left (e + f x \right )}}{3 f} & \text{for}\: f \neq 0 \\x \left (a + b \sin{\left (e \right )}\right ) \sin ^{2}{\left (e \right )} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)**2*(a+b*sin(f*x+e)),x)

[Out]

Piecewise((a*x*sin(e + f*x)**2/2 + a*x*cos(e + f*x)**2/2 - a*sin(e + f*x)*cos(e + f*x)/(2*f) - b*sin(e + f*x)*
*2*cos(e + f*x)/f - 2*b*cos(e + f*x)**3/(3*f), Ne(f, 0)), (x*(a + b*sin(e))*sin(e)**2, True))

________________________________________________________________________________________

Giac [A]  time = 1.68803, size = 68, normalized size = 1.24 \begin{align*} \frac{1}{2} \, a x + \frac{b \cos \left (3 \, f x + 3 \, e\right )}{12 \, f} - \frac{3 \, b \cos \left (f x + e\right )}{4 \, f} - \frac{a \sin \left (2 \, f x + 2 \, e\right )}{4 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(sin(f*x+e)^2*(a+b*sin(f*x+e)),x, algorithm="giac")

[Out]

1/2*a*x + 1/12*b*cos(3*f*x + 3*e)/f - 3/4*b*cos(f*x + e)/f - 1/4*a*sin(2*f*x + 2*e)/f